package com.wutong.jxgl.jsgl.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wutong.common.annotation.Log;
import com.wutong.common.core.controller.BaseController;
import com.wutong.common.core.domain.AjaxResult;
import com.wutong.common.enums.BusinessType;
import com.wutong.jxgl.jsgl.domain.Jsgl;
import com.wutong.jxgl.jsgl.service.IJsglService;
import com.wutong.common.utils.poi.ExcelUtil;
import com.wutong.common.core.page.TableDataInfo;

/**
 * 教师管理Controller
 * 
 * @author wutong
 * @date 2025-05-15
 */
@RestController
@RequestMapping("/jxgl/jsgl")
public class JsglController extends BaseController
{
    @Autowired
    private IJsglService jsglService;

    /**
     * 查询教师管理列表
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:list')")
    @GetMapping("/list")
    public TableDataInfo list(Jsgl jsgl)
    {
        startPage();
        List<Jsgl> list = jsglService.selectJsglList(jsgl);
        return getDataTable(list);
    }

    /**
     * 导出教师管理列表
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:export')")
    @Log(title = "教师管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Jsgl jsgl)
    {
        List<Jsgl> list = jsglService.selectJsglList(jsgl);
        ExcelUtil<Jsgl> util = new ExcelUtil<Jsgl>(Jsgl.class);
        util.exportExcel(response, list, "教师管理数据");
    }

    /**
     * 获取教师管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:query')")
    @GetMapping(value = "/{jsglId}")
    public AjaxResult getInfo(@PathVariable("jsglId") String jsglId)
    {
        return success(jsglService.selectJsglByJsglId(jsglId));
    }

    /**
     * 新增教师管理
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:add')")
    @Log(title = "教师管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Jsgl jsgl)
    {
        return toAjax(jsglService.insertJsgl(jsgl));
    }

    /**
     * 修改教师管理
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:edit')")
    @Log(title = "教师管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Jsgl jsgl)
    {
        return toAjax(jsglService.updateJsgl(jsgl));
    }

    /**
     * 删除教师管理
     */
    @PreAuthorize("@ss.hasPermi('jxgl:jsgl:remove')")
    @Log(title = "教师管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jsglIds}")
    public AjaxResult remove(@PathVariable String[] jsglIds)
    {
        return toAjax(jsglService.deleteJsglByJsglIds(jsglIds));
    }
}
